package com.netease.pris.c;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import com.netease.a.a.g;
import com.netease.g.b;
import com.netease.pris.provider.a;

public class i
{
  public static String[] a;
  public static final int b = 0;
  public static final int c = 1;
  public static final int d = 2;
  public static final int e = 3;
  public static final int f = 4;
  public static final int g = 5;
  public static final int h = 6;
  public static final int i = 7;
  public static final int j = 8;
  public static final int k = 9;
  public static final int l = 10;
  public static final int m = 11;
  private static final String n = "f";
  private static final String o = "data1 = 'f'";
  private static final String p = "data1 <> 'f'";
  private static String[] q;
  private static String[] r;

  static
  {
    String[] arrayOfString1 = new String[12];
    arrayOfString1[0] = "_id";
    arrayOfString1[1] = "account";
    arrayOfString1[2] = "url";
    arrayOfString1[3] = "lastmodify";
    arrayOfString1[4] = "filepath";
    arrayOfString1[5] = "expiresstring";
    arrayOfString1[6] = "expires";
    arrayOfString1[7] = "etag";
    arrayOfString1[8] = "encoding";
    arrayOfString1[9] = "contentlength";
    arrayOfString1[10] = "timestamp";
    arrayOfString1[11] = "data1";
    a = arrayOfString1;
    String[] arrayOfString2 = new String[1];
    arrayOfString2[0] = "COUNT(*)";
    q = arrayOfString2;
    String[] arrayOfString3 = new String[1];
    arrayOfString3[0] = "SUM(contentlength)";
    r = arrayOfString3;
  }

  private static long a(Context paramContext, String[] paramArrayOfString, String paramString)
  {
    Cursor localCursor = paramContext.getContentResolver().query(a.b, paramArrayOfString, paramString, null, null);
    long l1 = 0L;
    if (localCursor != null)
    {
      if (localCursor.moveToFirst())
        l1 = localCursor.getLong(0);
      localCursor.close();
    }
    return l1;
  }

  public static g a(Context paramContext, String paramString1, String paramString2)
  {
    g localg = null;
    if (paramString2 == null);
    while (true)
    {
      return localg;
      String str;
      String[] arrayOfString;
      label27: Cursor localCursor;
      if (paramString1 == null)
      {
        str = "url =?";
        arrayOfString = new String[1];
        arrayOfString[0] = paramString2;
        localCursor = paramContext.getContentResolver().query(a.b, a, str, arrayOfString, null);
        if (localCursor == null)
          break label226;
      }
      try
      {
        if (localCursor.moveToFirst())
        {
          localg = new g();
          localg.a(localCursor.getString(4));
          localg.e(localCursor.getString(3));
          localg.c(localCursor.getString(7));
          localg.c(localCursor.getLong(6));
          localg.d(localCursor.getString(5));
          localg.b(localCursor.getString(8));
          localg.b(localCursor.getLong(9));
          localg.a(localCursor.getLong(0));
          localg.a("f".equals(localCursor.getString(11)));
          if (localCursor == null)
            continue;
          localCursor.close();
          continue;
          str = "account = ? AND url = ?";
          arrayOfString = new String[2];
          arrayOfString[0] = paramString1;
          arrayOfString[1] = paramString2;
          break label27;
        }
        label226: if (localCursor == null)
          continue;
        localCursor.close();
      }
      finally
      {
        if (localCursor != null)
          localCursor.close();
      }
    }
  }

  private static String a(String paramString, long paramLong)
  {
    if (paramLong > 0L)
      if (!TextUtils.isEmpty(paramString))
        break label42;
    label42: for (String str = ""; ; str = paramString + " AND ")
    {
      paramString = str + "timestamp < " + paramLong;
      return paramString;
    }
  }

  public static void a(Context paramContext, long paramLong)
  {
    if (paramContext != null)
    {
      String str = a("data1 <> 'f'", paramLong);
      paramContext.getContentResolver().delete(a.b, str, null);
    }
  }

  public static void a(Context paramContext, String paramString)
  {
    a(paramContext, -1L);
  }

  public static void a(Context paramContext, String paramString, g paramg)
  {
    if ((paramContext != null) && (paramString != null))
    {
      ContentValues localContentValues = new ContentValues();
      if (paramg.c())
        localContentValues.put("data1", "f");
      localContentValues.put("filepath", paramg.e());
      localContentValues.put("timestamp", Long.valueOf(System.currentTimeMillis()));
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = a.b;
      String[] arrayOfString = new String[1];
      arrayOfString[0] = paramString;
      localContentResolver.update(localUri, localContentValues, "url =?", arrayOfString);
    }
  }

  public static void a(Context paramContext, String paramString1, String paramString2, g paramg)
  {
    if (paramString2 == null)
      return;
    ContentValues localContentValues = new ContentValues();
    localContentValues.put("account", paramString1);
    localContentValues.put("url", paramString2);
    localContentValues.put("lastmodify", paramg.h());
    localContentValues.put("filepath", paramg.e());
    localContentValues.put("expiresstring", paramg.g());
    localContentValues.put("expires", Long.valueOf(paramg.f()));
    localContentValues.put("etag", paramg.i());
    localContentValues.put("encoding", paramg.j());
    localContentValues.put("contentlength", Long.valueOf(paramg.d()));
    if (paramg.c());
    for (String str = "f"; ; str = "")
    {
      localContentValues.put("data1", str);
      paramContext.getContentResolver().insert(a.b, localContentValues);
      break;
    }
  }

  public static void b(Context paramContext, long paramLong)
  {
    if (paramContext != null)
    {
      String str = a("data1 = 'f'", paramLong);
      paramContext.getContentResolver().delete(a.b, str, null);
    }
  }

  public static void b(Context paramContext, String paramString)
  {
    b(paramContext, -1L);
  }

  public static void b(Context paramContext, String paramString, g paramg)
  {
    String str;
    if ((paramg == null) || (paramg.a() < 0L))
    {
      StringBuilder localStringBuilder = new StringBuilder().append("");
      if (paramg != null)
      {
        str = paramg.e();
        b.d("delete cache", str);
      }
    }
    while (true)
    {
      return;
      str = "";
      break;
      paramContext.getContentResolver().delete(ContentUris.withAppendedId(a.b, paramg.a()), "", null);
    }
  }

  public static long c(Context paramContext, long paramLong)
  {
    long l1;
    if (paramContext != null)
    {
      String str = a("data1 <> 'f'", paramLong);
      l1 = a(paramContext, q, str);
    }
    while (true)
    {
      return l1;
      l1 = 0L;
    }
  }

  public static long d(Context paramContext, long paramLong)
  {
    long l1;
    if (paramContext != null)
    {
      String str = a("data1 = 'f'", paramLong);
      l1 = a(paramContext, q, str);
    }
    while (true)
    {
      return l1;
      l1 = 0L;
    }
  }

  public static long e(Context paramContext, long paramLong)
  {
    long l1;
    if (paramContext != null)
    {
      String str = a("data1 <> 'f'", paramLong);
      l1 = a(paramContext, r, str);
    }
    while (true)
    {
      return l1;
      l1 = 0L;
    }
  }

  public static long f(Context paramContext, long paramLong)
  {
    long l1;
    if (paramContext != null)
    {
      String str = a("data1 = 'f'", paramLong);
      l1 = a(paramContext, r, str);
    }
    while (true)
    {
      return l1;
      l1 = 0L;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.c.i
 * JD-Core Version:    0.6.0
 */